/* AI聊天组件样式 */
.ai-chat-container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.chat-card {
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.chat-card .ant-card-head {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-bottom: none;
}

.chat-card .ant-card-head-title {
  color: white;
  font-weight: 600;
}

.chat-card .ant-card-extra {
  color: white;
}

/* 消息容器 */
.messages-container {
  height: 400px;
  overflow-y: auto;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 16px;
  scrollbar-width: thin;
  scrollbar-color: #c1c1c1 #f8f9fa;
}

.messages-container::-webkit-scrollbar {
  width: 6px;
}

.messages-container::-webkit-scrollbar-track {
  background: #f8f9fa;
}

.messages-container::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 消息样式 */
.message {
  display: flex;
  margin-bottom: 16px;
  animation: messageSlideIn 0.3s ease-out;
}

.message.user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin: 0 8px;
  flex-shrink: 0;
}

.message-avatar.user {
  background: #1890ff;
}

.message-avatar.ai {
  background: #52c41a;
}

.message-content {
  max-width: 70%;
  word-wrap: break-word;
}

.message-text {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
}

.message.user .message-text {
  background: #1890ff;
  color: white;
  border-bottom-right-radius: 4px;
}

.message.ai .message-text {
  background: white;
  color: #333;
  border: 1px solid #e8e8e8;
  border-bottom-left-radius: 4px;
}

.message.speaking .message-text {
  background: #f0f8ff;
  border-color: #1890ff;
  animation: speakingPulse 1.5s ease-in-out infinite;
}

.message-time {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
  text-align: center;
}

.message.user .message-time {
  text-align: right;
}

.message.ai .message-time {
  text-align: left;
}

/* 空状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #999;
  text-align: center;
}

.empty-state .anticon {
  margin-bottom: 16px;
}

/* 加载指示器 */
.loading-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.loading-dots {
  display: flex;
  gap: 4px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1890ff;
  animation: loadingDot 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0s;
}

/* 说话指示器 */
.speaking-indicator {
  display: flex;
  align-items: center;
  margin-left: 8px;
}

.speaking-dots {
  display: flex;
  gap: 2px;
}

.speaking-dots span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: white;
  animation: speakingDot 1.2s ease-in-out infinite;
}

.speaking-dots span:nth-child(1) {
  animation-delay: 0s;
}

.speaking-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.speaking-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

/* 语音识别状态 */
.voice-recognition-status {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: #f0f8ff;
  border-radius: 8px;
  margin-bottom: 12px;
  border: 1px solid #d6e4ff;
}

.recording-indicator {
  margin-right: 8px;
}

.recording-dots {
  display: flex;
  gap: 3px;
}

.recording-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff4d4f;
  animation: recordingDot 1s ease-in-out infinite;
}

.recording-dots span:nth-child(1) {
  animation-delay: 0s;
}

.recording-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.recording-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

/* 语音识别结果 */
.voice-recognition-result {
  padding: 8px 12px;
  background: #f6ffed;
  border: 1px solid #b7eb8f;
  border-radius: 6px;
  margin-bottom: 12px;
}

/* 语音识别错误 */
.voice-recognition-error {
  padding: 8px 12px;
  background: #fff2f0;
  border: 1px solid #ffccc7;
  border-radius: 6px;
  margin-bottom: 12px;
}

/* 输入区域 */
.input-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message-input {
  border-radius: 8px;
  border: 1px solid #d9d9d9;
  transition: all 0.3s;
}

.message-input:focus {
  border-color: #1890ff;
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

.message-input:disabled {
  background: #f5f5f5;
  color: #999;
}

/* 输入按钮区域 */
.input-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.voice-button {
  border-radius: 8px;
  transition: all 0.3s;
}

.voice-button:hover {
  transform: scale(1.05);
}

.voice-button.ant-btn-dangerous {
  background: #ff4d4f;
  border-color: #ff4d4f;
}

.voice-button.ant-btn-dangerous:hover {
  background: #ff7875;
  border-color: #ff7875;
}

.send-button {
  border-radius: 8px;
  transition: all 0.3s;
}

.send-button:hover {
  transform: scale(1.05);
}

/* 设置弹窗 */
.settings-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.setting-item:last-child {
  border-bottom: none;
}

.range-slider {
  width: 120px;
  margin: 0 12px;
}

/* 动画 */
@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes speakingPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(24, 144, 255, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(24, 144, 255, 0);
  }
}

@keyframes speakingDot {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes loadingDot {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes recordingDot {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .ai-chat-container {
    max-width: 100%;
    padding: 0 16px;
  }
  
  .messages-container {
    height: 300px;
  }
  
  .message-content {
    max-width: 85%;
  }
  
  .input-buttons {
    flex-direction: row;
  }
  
  .voice-button,
  .send-button {
    flex: 1;
  }
}

/* 深色主题适配 */
[data-theme="dark"] .chat-card {
  background: #1f1f1f;
  border-color: #434343;
}

[data-theme="dark"] .messages-container {
  background: #141414;
  scrollbar-color: #434343 #141414;
}

[data-theme="dark"] .messages-container::-webkit-scrollbar-track {
  background: #141414;
}

[data-theme="dark"] .messages-container::-webkit-scrollbar-thumb {
  background: #434343;
}

[data-theme="dark"] .messages-container::-webkit-scrollbar-thumb:hover {
  background: #595959;
}

[data-theme="dark"] .message.ai .message-text {
  background: #262626;
  color: #fff;
  border-color: #434343;
}

[data-theme="dark"] .message.speaking .message-text {
  background: #1a365d;
  border-color: #1890ff;
}

[data-theme="dark"] .message-time {
  color: #8c8c8c;
}

[data-theme="dark"] .empty-state {
  color: #8c8c8c;
}

[data-theme="dark"] .voice-recognition-status {
  background: #1a365d;
  border-color: #1890ff;
}

[data-theme="dark"] .voice-recognition-result {
  background: #162312;
  border-color: #52c41a;
}

[data-theme="dark"] .voice-recognition-error {
  background: #2a1215;
  border-color: #ff4d4f;
}

[data-theme="dark"] .message-input {
  background: #262626;
  border-color: #434343;
  color: #fff;
}

[data-theme="dark"] .message-input:focus {
  border-color: #1890ff;
}

[data-theme="dark"] .message-input:disabled {
  background: #1f1f1f;
  color: #8c8c8c;
}

[data-theme="dark"] .setting-item {
  border-bottom-color: #434343;
} 